function ShellExec(const Verb, Filename, Params, WorkingDir: String; const ShowCmd: Integer; const Wait: TExecWait; var ErrorCode: Integer): Boolean;
Opens the specified file, or performs another action specified by Verb. The filename can be an executable file, a document file, or a folder. The Wait parameter specifies whether the function should return immediately or wait until the launched process has termimated or is idle. Returns True if the specified file was opened successfully, False otherwise. If False is returned then ErrorCode specifies the error that occurred. Use SysErrorMessage(ErrorCode) to get a description of the error.
TExecWait is defined as:
TExecWait = (ewNoWait, ewWaitUntilTerminated, ewWaitUntilIdle);
var ErrorCode: Integer; begin if not ShellExec('open', ExpandConstant('{app}\filename.rtf'), '', '', SW_SHOW, ewNoWait, ErrorCode) then begin // handle failure if necessary end; end;